<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>确认订单</title>
    <link rel="stylesheet" type="text/css" href="../../../css/index.css" />
    <style>

       	.address-list{width: 100%;}
		.address-list .address-one{width: 100%;padding: 10px 15px;box-sizing: border-box;margin-bottom: 10px;
        background: url(../../../image/main2/sel_icon0.png) no-repeat right 15px center #ffffff;background-size:20px;}
		.address-list .address-one .top-box{align-items: center;font-size: 14px;color: #333333;padding-top: 10px;box-sizing: border-box;line-height: 16px;}
		.address-list .address-one .top-box .phone{padding-left:10px;box-sizing: border-box;}
    	.address-list .address-one .top-box .moren{padding:0 4px;font-size: 10px;color:#FF9502;height: 14px;line-height: 15px;margin-left: 10px;}
        .address-list .address-one .top-box .moren::before{border: 1px solid #FF9502;border-radius: 4px;}
    	.address-list .address-one .content{font-size: 14px;color:#999999;word-break: break-all;padding: 6px 30px 10px 0;box-sizing: border-box;line-height: 22px}
        .address-list .address-one.on{background: url(../../../image/main2/sel_icon1.png) no-repeat right 15px center #ffffff;background-size:20px;}

        /*底部的固定按钮*/
		.shouhuo-btn{position: fixed;height: 45px;background:#FF9502;border-radius:4px;
		text-align: center;line-height: 45px;font-size: 18px;color: #FFFFFF;bottom: 40px;left: 30px;right: 30px;z-index: 999;}

    </style>
</head>

<body>
    <div id="vue">

    	<div class="address-list" style="display:none;" :style="{ display:(Pdata ? '':'none')}">

            <!--地址列表-->
    		<div class="address-one" v-for="(item,k) in Pdata.listData" :data-id="item.id" :data-key="k" tapdome onclick="selectClick(this)">
    			<div class="top-box flex">
    				<div class="name" v-text="item.uname"></div>
    				<div class="phone" v-text="item.phone"></div>
    				<div class="moren border-all" v-if="item.default == 1">默认</div>
    			</div>
                <div class="content" v-text="item.qustr + item.address"></div>
    		</div>

    	</div>

        <!--占位图-->
        <div class="nodata" style="display:none;" :style="{ display:(noData ? '':'none')}">
            <img src="../../../image/no_page/no_dizhi.png" />
            <p>暂无退货地址</p>
        </div>

        <!-- 底部 -->
        <div class="bottom-box" :style="{ display:(loadingMsg ? '':'none')}">
            <div class="msgbox" v-html="loadingMsg" style="color:#999;"></div>
        </div>

    	<!--底部的立即分享按钮-->
        <div class="warp-btn" id="app-footer" tapdome onclick="selAddress(this)">
            <div class="btn">确定</div>
        </div>

    </div>

<script type="text/javascript" src="../../../script/base.min.js" id="loadjs" data-load=""></script>
<script type="text/javascript">
    define(function (require, exports, module) {
        lanYun.setFooter('app-footer');
        var sdata = {};
        sdata.id = pageParam.id;

        getData = function(loading) {
            lanYun.getVueData({url:'store/Tuiaddress/index',get:{page:lanYun.page},cache:true,loading:loading}, function(ret) {
                //console.log(JSON.stringify(ret));
            });
        };
        lanYun.newVue('#vue', function() {
            getData();
        });

        //滚动加载..
    	new auiScroll({distance:200, listen:true},function(ret) {
    		if($(window).scrollTop() < 2) ret.isToBottom = false;
    		if(!ret.isToBottom) return;
    		getData(0);
    	});

        //============================

        onShow = function () {
            var reshpage = lanYun.getStorage('reshpage');
            if(reshpage){
                lanYun.rmStorage('reshpage');
                lanYun.ajaxPageSta = 0; lanYun.page = 1;
                getData(2);
            }
        }

        //新增地址
        topMenuClick = function(tis){
            lanYun.openWin('main3/store/store_address_add.html', {
                title : '新建退货地址',
                frameParam : {type:'add'},
            });
        };

        //选择地址
        selectClick = function(tis){
            var dst = tis.dataset;
            $(tis).siblings().removeClass('on');
            $(tis).addClass('on');
            var data = lanYun.vue.Pdata.listData[dst.key];
            sdata.address = data;
        }

        // 确定退货地址
        selAddress = function (){
            if(!sdata.address){
                lanYun.toast('请选择退货地址');
                return;
            }
            lanYun.post( 'store/Ordertui/pass' , sdata , function(ret) {
                lanYun.toast(ret.msg);
	            if(ret.errcode == 0){
	                lanYun.setStorage('reshpage',1);
                    setTimeout(function(){
						api.closeWin();
					},800)
	            }
	        },2);
        }

    });
</script>
</body>
</html>
